import { GCellRenderer } from "../../../../com/mui/controls/GCellRenderer";
import { ObjCreate } from "../common/ObjCreate";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { SCountryMoneyRecord } from "../../../../Message/Game/SCountryMoneyRecord";
import { Log } from "../../../../com/gengine/debug/Log";
import { EntityUtil } from "../../scene/layer/utils/EntityUtil";
import { DateParser } from "../../../common/tools/DateParser";
import { Language } from "../../../../extend/language/Language";
import { ECountryMoneyEvent } from "../../../../Message/Game/ECountryMoneyEvent";
import { EUpdateType } from "../../../../Message/Public/EUpdateType";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
//class CountryMoneyRecordRenderer
    
    export  class CountryMoneyRecordRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ configUI(): void
        {
            this._infoTxt = ObjCreate.createGTextField("", 0, 0, 210, 60, this, GlobalStyle.setTextFormatLeading(GlobalStyle.textFormat1, 3));
            this._infoTxt.wordWrap = true;
            this._infoTxt.multiline = true;
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            var loc1=0;
            var loc2=0;
            var loc3=null;
            var loc4=null;
            var loc5=null;
            var loc6=null;
            var loc7=null;
            super.data = arg1;
            if (arg1 && arg1 is SCountryMoneyRecord) 
            {
                this._record = arg1 as SCountryMoneyRecord;
                if (this._record.event == null) 
                {
                    Log.error("_record.event null");
                }
                if (this._record.updateType == null) 
                {
                    Log.error("_record.updateType null");
                }
                if (this._record.playerName == null) 
                {
                    Log.error("_record.playerName null");
                }
                if (this._record.recordDt == null) 
                {
                    Log.error("_record.recordDt null");
                }
                loc1 = this._record.event.__value;
                loc2 = this._record.updateType.__value;
                loc3 = "";
                loc4 = "";
                if (this._record.playerName != null) 
                {
                    loc4 = "<font color=\'#ffff00\'>" + this._record.playerName + "</font>";
                }
                loc5 = "<font color=\'#ff00ff\'>" + this._record.updateValue + "</font>";
                if ((loc6 = "<font color=\'#ffff00\'>[" + EntityUtil.getProxyNameByProxyAndServer(this._record.proxyId, this._record.serverId) + "]</font>") == null) 
                {
                    Log.error("serverName null");
                }
                loc3 = (loc7 = DateParser.parse(this._record.recordDt, Language.getString(36516))) + loc3;
                var loc8=loc1;
                switch (loc8) 
                {
                    case ECountryMoneyEvent._ECountryMoneyEventGiveProp:
                    {
                        loc3 = loc3 + loc4 + Language.getString(36510) + loc5;
                        break;
                    }
                    case ECountryMoneyEvent._ECountryMoneyEventKillKing:
                    {
                        loc3 = loc3 + Language.getStringByParam(36511, loc4, loc6, loc5);
                        break;
                    }
                    case ECountryMoneyEvent._ECountryMoneyEventKingKilled:
                    {
                        loc3 = loc3 + loc6 + Language.getString(36512) + loc5;
                        break;
                    }
                    case ECountryMoneyEvent._ECountryMoneyEventPlundered:
                    {
                        if (loc2 != EUpdateType._EUpdateTypeAdd) 
                        {
                            loc3 = loc3 + loc6 + loc4 + Language.getString(36513) + loc5;
                        }
                        else 
                        {
                            loc3 = loc3 + loc6 + loc4 + Language.getString(36517) + loc5;
                        }
                        break;
                    }
                    case ECountryMoneyEvent._ECountryMoneyEventPlayerOpenReset:
                    {
                        loc3 = loc3 + loc4 + Language.getString(36514) + loc5;
                        break;
                    }
                    case ECountryMoneyEvent._ECountryMoneyEventSystemOpenReset:
                    {
                        loc3 = loc3 + Language.getString(36515) + loc5;
                        break;
                    }
                }
                if (this._infoTxt == null) 
                {
                    Log.error("_infoTxt null");
                }
                this._infoTxt.htmlText = loc3;
            }
            else 
            {
                if (this._infoTxt == null) 
                {
                    Log.error("_infoTxt null");
                }
                this._infoTxt.htmlText = "";
            }
            return;
        }

        /* internal */ /* var */_infoTxt: GTextFiled;

        /* internal */ /* var */_record: SCountryMoneyRecord;
    }
